<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>酷付</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: #f8f9fa;
            color: #333;
            line-height: 1.6;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }

        /* Header */
        header {
            padding: 20px 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 24px;
            font-weight: 700;
        }

        .logo-icon {
            width: 40px;
            height: 40px;
            background: linear-gradient(45deg, #2dce89, #00c853);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 18px;
        }

        .login-btn {
            background: rgba(0, 0, 0, 0.05);
            border: 1px solid rgba(0, 0, 0, 0.1);
            color: #333;
            padding: 10px 24px;
            border-radius: 9999px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .login-btn:hover {
            background: rgba(0, 0, 0, 0.1);
        }

        /* Hero Section */
        .hero {
            padding: 100px 0;
            text-align: center;
        }

        .hero h1 {
            font-size: 4rem;
            font-weight: 800;
            margin-bottom: 24px;
            background: linear-gradient(to right, #333, #555);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            position: relative;
        }

        .hero h1::after {
            content: "";
            position: absolute;
            bottom: -10px;
            left: 50%;
            transform: translateX(-50%);
            width: 200px;
            height: 4px;
            background: linear-gradient(to right, #2dce89, #00c853);
            border-radius: 2px;
        }

        .hero p {
            font-size: 1.5rem;
            color: #4b5563;
            max-width: 700px;
            margin: 0 auto 40px;
        }

        .hero-subtitle {
            font-size: 1.2rem;
            color: #6b7280;
            max-width: 600px;
            margin: 0 auto 50px;
            font-weight: 300;
        }

        .cta-buttons {
            display: flex;
            justify-content: center;
            gap: 20px;
            margin-bottom: 60px;
        }

        .primary-btn {
            background: linear-gradient(45deg, #2dce89, #00c853);
            color: white;
            border: none;
            padding: 16px 40px;
            font-size: 1.2rem;
            font-weight: 600;
            border-radius: 16px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .primary-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 10px 25px rgba(45, 206, 137, 0.3);
        }

        .secondary-btn {
            background: transparent;
            color: #333;
            border: 2px solid rgba(0, 0, 0, 0.2);
            padding: 16px 40px;
            font-size: 1.2rem;
            font-weight: 600;
            border-radius: 16px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .secondary-btn:hover {
            border-color: rgba(0, 0, 0, 0.4);
            background: rgba(0, 0, 0, 0.05);
        }

        .features-tags {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 20px;
            margin-top: 50px;
        }

        .tag {
            display: flex;
            align-items: center;
            background: rgba(255, 255, 255, 0.05);
            backdrop-filter: blur(10px);
            padding: 12px 24px;
            border-radius: 9999px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .tag-indicator {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            margin-right: 12px;
        }

        .tag-1 .tag-indicator {
            background: #2dce89;
        }
        .tag-2 .tag-indicator {
            background: #00c853;
        }
        .tag-3 .tag-indicator {
            background: #10b981;
        }

        /* Features Section */
        .features {
            padding: 100px 0;
        }

        .section-title {
            text-align: center;
            font-size: 2.5rem;
            font-weight: 700;
            margin-bottom: 80px;
            background: linear-gradient(to right, #333, #6b7280);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .features-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 40px;
        }

        .feature-card {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 24px;
            padding: 40px 30px;
            text-align: center;
            transition: all 0.3s ease;
        }

        .feature-card:hover {
            transform: translateY(-10px);
            background: rgba(255, 255, 255, 0.1);
            box-shadow: 0 20px 30px rgba(0, 0, 0, 0.2);
        }

        .feature-icon {
            font-size: 4rem;
            margin-bottom: 20px;
        }

        .feature-title {
            font-size: 1.5rem;
            font-weight: 600;
            margin-bottom: 15px;
        }

        .feature-desc {
            color: #6b7280;
            font-size: 1.1rem;
        }

        /* CTA Section */
        .cta-section {
            padding: 150px 0;
            text-align: center;
        }

        .cta-title {
            font-size: 3rem;
            font-weight: 800;
            margin-bottom: 20px;
        }

        .cta-subtitle {
            font-size: 1.5rem;
            color: #4b5563;
            max-width: 700px;
            margin: 0 auto 50px;
        }

        /* Footer */
        footer {
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            padding: 50px 0 30px;
            text-align: center;
            background: rgba(0, 0, 0, 0.2);
        }

        .footer-logo {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 10px;
            margin-bottom: 20px;
            font-size: 1.5rem;
            font-weight: 600;
        }

        .footer-logo-icon {
            width: 32px;
            height: 32px;
            background: linear-gradient(45deg, #2dce89, #00c853);
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 14px;
        }

        .copyright {
            color: #6b7280;
            font-size: 0.9rem;
            margin-bottom: 10px;
        }

        .description {
            color: #9ca3af;
            font-size: 0.8rem;
        }

        /* Responsive */
        @media (max-width: 768px) {
            .hero h1 {
                font-size: 2.5rem;
            }

            .hero p {
                font-size: 1.2rem;
            }

            .cta-buttons {
                flex-direction: column;
                align-items: center;
            }

            .primary-btn, .secondary-btn {
                width: 100%;
                max-width: 300px;
                justify-content: center;
            }
        }

    </style>
    <style>
        #qrdiv{
            position: relative;
            left: 0px;
            width: 200px;
            height: 200px;
            margin: 0px auto;
        }
        #icon{
            position: absolute;
            width: 200px;
            height: 200px;
            background:rgba(0,0,0,0.7);
            line-height: 200px;
            text-align: center;
            color: #fff;
            font-size: 18px;
            overflow: hidden;
        }
        
        /* 微信登录弹窗样式优化 */
        .modal-overlay {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            backdrop-filter: blur(5px);
            animation: fadeIn 0.3s ease-out;
        }
        
        .modal-content {
            background-color: #fff;
            margin: 10% auto;
            padding: 30px;
            border-radius: 16px;
            width: 80%;
            max-width: 400px;
            text-align: center;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            animation: slideIn 0.3s ease-out;
            position: relative;
        }
        
        .modal-close {
            position: absolute;
            right: 20px;
            top: 20px;
            font-size: 28px;
            font-weight: bold;
            cursor: pointer;
            color: #999;
            transition: color 0.3s;
        }
        
        .modal-close:hover {
            color: #333;
        }
        
        .modal-title {
            font-size: 22px;
            font-weight: 600;
            margin-bottom: 20px;
            color: #333;
        }
        
        .modal-subtitle {
            font-size: 14px;
            color: #666;
            margin-bottom: 25px;
        }
        
        /* API密钥弹窗样式优化 */
        .api-modal-content {
            background: white;
            padding: 30px;
            border-radius: 16px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            max-width: 600px;
            width: 95%;
            max-height: 90vh;
            overflow-y: auto;
            position: relative;
            animation: modalOpen 0.3s ease-out;
        }
        
        .api-modal-title {
            margin-top: 0;
            color: #333;
            text-align: center;
            font-size: 22px;
            font-weight: 600;
            margin-bottom: 25px;
        }
        
        .api-modal-field {
            margin: 20px 0;
            text-align: left;
        }
        
        .api-modal-label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #555;
        }
        
        .api-modal-value {
            font-family: monospace;
            background: #f8f9fa;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            font-size: 14px;
            line-height: 1.5;
            word-break: break-all;
            border: 1px solid #e9ecef;
            white-space: pre-wrap;
        }
        
        .api-modal-close-btn {
            background: linear-gradient(45deg, #2dce89, #00c853);
            color: white;
            border: none;
            padding: 12px 30px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 500;
            width: 100%;
            transition: all 0.3s;
        }
        
        .api-modal-close-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(45, 206, 137, 0.3);
        }
        
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        
        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(-30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        @keyframes modalOpen {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
    </style>
</head>
<body>
<div class="container">
    <header>
        <div class="logo">
            <div class="logo-icon">Cuu</div>
            <span>酷付</span>
        </div>
        <a href="javascript:void(0)" class="login-btn" id="login-btn-id" onclick="showWechatLogin()">登录</a>
    </header>
    <!-- 微信登录弹窗 -->
    <div id="wechatModal" class="modal-overlay">
        <div class="modal-content">
            <span class="modal-close" onclick="closeWechatLogin()">&times;</span>
            <h3 class="modal-title">微信扫码登录</h3>
            <p class="modal-subtitle">请使用微信扫描二维码完成登录</p>
            <div id="qrCodeContainer">
                <div id="qrdiv">
                    <div id="icon" style="display: none"></div>
                    <img src="" id="qrimg"
                         style="width: 100%;height: 100%;margin: 0px auto;display: none" alt="" />
                </div>
                <input type="hidden" id="sig"/>
            </div>
            <p class="text-muted mb-0" id="msg"></p>
        </div>
    </div>

    <section class="hero">
        <input type="hidden" id="uid"/>
        <input type="hidden" id="apikey"/>
        <input type="hidden" id="isailpay"/>
        <h1>Cuu~ 酷付</h1>
        <p>让个人开发者，玩转Agent，轻松实现支付</p>
        <div class="hero-subtitle">个人开发者 无需企业资质 · 极速接入 · 一站式服务 · 自动结算</div>
        <div class="cta-buttons">
            <button class="primary-btn">
                获取 API Key 授权
                <div style="width: 8px; height: 8px; background: white; border-radius: 50%; animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;"></div>
            </button>

            <button class="secondary-btn"> 🔧设置提现账号</button>

        </div>

        <div class="features-tags">
            <div class="tag tag-1">
                <div class="tag-indicator"></div>
                <span></span>
                <span>支持支付宝、微信</span>
            </div>
            <div class="tag tag-2">
                <div class="tag-indicator"></div>
                <span>15% 透明费率</span>
            </div>
            <div class="tag tag-3">
                <div class="tag-indicator"></div>
                <span>支持Dify插件开发</span>
            </div>
        </div>
    </section>

    <section class="features" id="features">
        <h2 class="section-title">核心功能</h2>
        <div class="features-grid">
            <div class="feature-card">
                <div class="feature-icon">⚡</div>
                <h3 class="feature-title">极速接入</h3>
                <p class="feature-desc">无需企业资质，个人即可快速接入收款能力</p>
            </div>

            <div class="feature-card">
                <div class="feature-icon">✅</div>
                <h3 class="feature-title">多渠道支付</h3>
                <p class="feature-desc">支持支付宝、微信等多种支付方式，满足用户不同需求</p>
            </div>

            <div class="feature-card">
                <div class="feature-icon">📱</div>
                <h3 class="feature-title">易集成</h3>
                <p class="feature-desc">提供标准化API接口，轻松集成到任何应用中</p>
            </div>
        </div>
    </section>
</div>

<footer>
    <div class="container">
        <div class="copyright">© 2025 酷付. All Rights Reserved.</div>
        <div class="description">个人开发者的收款 API 解决方案</div>
    </div>
</footer>

<style>
    @keyframes ping {
        0% {
            transform: scale(1);
            opacity: 1;
        }
        75%, 100% {
            transform: scale(2);
            opacity: 0;
        }
    }
</style>



<!-- Scripts -->
<script type="text/javascript" src="//code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- 添加二维码生成库 -->
<script src="//cdn.bootcdn.net/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
<script>
    function showWechatLogin() {
        document.getElementById('wechatModal').style.display = 'block';
        getQr();
    }

    function closeWechatLogin() {
        document.getElementById('wechatModal').style.display = 'none';
    }
    var num = 0;
    var sw = true;
    var qrcode = null; // 用于存储二维码对象
    function getQr() {
        $.ajax({
            type: "POST",
            url: "/login/qqlogin/getqr",
            data: {'': ''},
            dataType: "json",
            success: function (json) {
                var data = $.parseJSON(json);
                if (data.code == 0) {
                    $("#sig").val(data.qrsig);
                    // 移除旧的二维码
                    if (qrcode) {
                        qrcode.clear();
                        qrcode.makeCode(data.data); // 重新生成二维码
                    } else {
                        // 创建新的二维码
                        $("#qrimg").remove(); // 移除旧的img标签
                        $("#qrdiv").append('<div id="qrcode" style="width: 100%; height: 100%;"></div>'); // 添加二维码容器
                        qrcode = new QRCode(document.getElementById("qrcode"), {
                            text: data.data,
                            width: 200,
                            height: 200,
                            colorDark : "#000000",
                            colorLight : "#ffffff",
                            correctLevel : QRCode.CorrectLevel.H
                        });
                    }
                    $("#icon").css("display", "none");
                } else {
                    var indexa = layer.alert(data.msg, {title: data.title, icon: 5}, function () {
                        layer.close(indexa);
                    })
                    $("#icon").css("display", "block");
                    $("#icon").html("获取失败");
                }
            },
            error: function () { //ERROR
                layer.msg('系统繁忙');
                return false;
            }
        });
    };
    setInterval(function (){
        islogin();
        num++;
    }, 6000);


    // 检查是否登录完成
    function islogin() {
        if(sw===false){
            return;
        }
        $.ajax({
            type: "post",
            dataType: "json",
            url: "/login/qqlogin/islogin",
            timeout: 10000, //ajax请求超时时间10s
            data: {"qrsig": document.getElementById('sig').value}, //post数据
            success: function (json, textStatus) {
                var data = $.parseJSON(json);
                //从服务器得到数据，显示数据并继续查询
                if (data.code == -1) {
                    //异常
                    var indexa = layer.alert(data.msg, {title: data.title, icon: 5}, function () {
                        layer.close(indexa);
                    })
                } else if (data.code == 3) {
                    //二维码失效
                    $("#msg").html("正在验证二维码...");
                }else if (data.code == 0) {
                    //登录成功
                    $("#uid").val(data.uid);
                    $("#apikey").val(data.apikey);
                    $("#isailpay").val(data.isailpay);
                    $("#login-btn-id").html(data.nickname);
                    closeWechatLogin();
                    $("#wechatModal").remove(); // 移除旧的img标签
                    sw=false;
                    if(data.strpos == 0){
                        // 显示已开通
                        const setAlipayBtn = document.querySelector('.secondary-btn');
                        setAlipayBtn.textContent = '✅ 已设置提现账号';
                        setAlipayBtn.disabled = true;
                        // 添加结算时间提示
                        const settlementInfo = document.createElement('div');
                        settlementInfo.textContent = '次日9点结算';
                        settlementInfo.style.fontSize = '12px';
                        settlementInfo.style.color = '#666';
                        settlementInfo.style.marginTop = '4px';
                        setAlipayBtn.parentNode.appendChild(settlementInfo);
                    }
                } else {
                    //其他
                    $("#msg").html(data.msg);
                    setTimeout("islogin()", 2000);
                }
            },
            //Ajax请求超时，继续查询
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                if (textStatus == "timeout") {
                    setTimeout("islogin()", 1000);
                } else { //异常
                    setTimeout("islogin()", 4000);
                }
            }
        });
    }
    $('.primary-btn').click(function() {
        // 获取页面上已存在的 uid 和 apikey
        var uid = $('#uid').val();
        var apikey = $('#apikey').val();
        console.log('UID:', uid);
        console.log('API Key:', apikey);
        // 判断是否存在
        if (uid && apikey && uid.trim() !== '' && apikey.trim() !== '') {
            // 创建自定义弹窗
            var modalHtml = `<div id="apiModal" class="modal-overlay" style="display: flex; justify-content: center; align-items: center;">
                <div class="api-modal-content">
                    <h3 class="api-modal-title">API 授权信息</h3>
                    <div class="api-modal-field">
                        <label class="api-modal-label">UID:</label>
                        <div class="api-modal-value">${uid}</div>
                    </div>
                    <div class="api-modal-field">
                        <label class="api-modal-label">API Key:</label>
                        <div class="api-modal-value">${apikey}</div>
                    </div>
                    <button id="closeModal" class="api-modal-close-btn">确定</button>
                </div>
            </div>`;

            // 添加到页面
            $('body').append(modalHtml);

            // 关闭弹窗事件
            $(document).on('click', '#closeModal, #apiModal', function(e) {
                if (e.target.id === 'closeModal' || e.target.id === 'apiModal') {
                    $('#apiModal').remove();
                }
            });
        }else{
            showWechatLogin();
        }
    });

    document.addEventListener('DOMContentLoaded', function() {
        // 添加设置支付宝按钮事件监听
        const setAlipayBtn = document.querySelector('.secondary-btn');
        if (setAlipayBtn) {
            setAlipayBtn.addEventListener('click', function() {
                // 判断 isailpay 是否有值
                const isAlipaySet = document.getElementById('isailpay')?.value === 'true';

                // 如果已设置支付宝，则直接显示已开通
                if (isAlipaySet) {
                    setAlipayBtn.textContent = '✅ 已设置提现账号';
                    setAlipayBtn.disabled = true;
                    // 添加结算时间提示
                    const settlementInfo = document.createElement('div');
                    settlementInfo.textContent = '次日9点结算';
                    settlementInfo.style.fontSize = '12px';
                    settlementInfo.style.color = '#666';
                    settlementInfo.style.marginTop = '4px';
                    setAlipayBtn.parentNode.appendChild(settlementInfo);
                    return;
                }

                // 否则检查是否已扫码登录
                const uid = document.getElementById('uid')?.value;
                if (!uid) {
                    // 未登录，提示用户扫码
                    showWechatLogin();
                    return;
                }

                // 已登录但未设置支付宝，显示设置表单
                // 创建弹窗表单
                const formHtml = `
                    <div id="alipayModal" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9999; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(5px);">
                        <div style="background: white; padding: 30px; border-radius: 16px; width: 90%; max-width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); transform: translateY(0); animation: modalOpen 0.3s ease-out;">
                            <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
                                <h3 style="margin: 0; color: #333; font-size: 20px;">设置支付宝</h3>
                                <span id="closeModal" style="cursor: pointer; font-size: 24px; color: #999;">&times;</span>
                            </div>
                            <div style="margin-bottom: 20px;">
                                <label style="display: block; margin-bottom: 8px; font-weight: 500; color: #555;">支付宝账号</label>
                                <input type="text" id="transIn" style="width: 100%; padding: 12px; box-sizing: border-box; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; transition: border-color 0.3s;" placeholder="请输入支付宝账号或手机号">
                            </div>
                            <div style="margin-bottom: 20px;">
                                <label style="display: block; margin-bottom: 8px; font-weight: 500; color: #555;">真实姓名</label>
                                <input type="text" id="name" style="width: 100%; padding: 12px; box-sizing: border-box; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; transition: border-color 0.3s;" placeholder="请输入真实姓名">
                            </div>
                            <div style="margin-bottom: 25px;">
                                <label style="display: block; margin-bottom: 8px; font-weight: 500; color: #555;">身份证号</label>
                                <input type="text" id="certNo" style="width: 100%; padding: 12px; box-sizing: border-box; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; transition: border-color 0.3s;" placeholder="请输入身份证号码">
                            </div>
                            <div style="display: flex; gap: 10px;">
                                <button id="cancelBtn" style="flex: 1; padding: 12px; background: #f5f5f5; color: #666; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.3s;">取消</button>
                                <button id="confirmBtn" style="flex: 1; padding: 12px; background: linear-gradient(45deg, #2dce89, #00c853); color: white; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.3s;">确认</button>
                            </div>
                        </div>
                    </div>
                    <style>
                        @keyframes modalOpen {
                            from {
                                opacity: 0;
                                transform: translateY(-20px);
                            }
                            to {
                                opacity: 1;
                                transform: translateY(0);
                            }
                        }
                        #alipayModal input:focus {
                            outline: none;
                            border-color: #2dce89;
                            box-shadow: 0 0 0 3px rgba(45, 206, 137, 0.1);
                        }
                    </style>
                `;
                
                // 插入到页面中
                document.body.insertAdjacentHTML('beforeend', formHtml);
                
                // 获取弹窗元素
                const modal = document.getElementById('alipayModal');
                const cancelBtn = document.getElementById('cancelBtn');
                const confirmBtn = document.getElementById('confirmBtn');
                const closeModal = document.getElementById('closeModal');
                
                // 取消按钮事件
                cancelBtn.addEventListener('click', function() {
                    modal.remove();
                });
                
                // 关闭按钮事件
                closeModal.addEventListener('click', function() {
                    modal.remove();
                });
                
                // 确认按钮事件
                confirmBtn.addEventListener('click', function() {
                    const transIn = document.getElementById('transIn').value.trim();
                    const name = document.getElementById('name').value.trim();
                    const certNo = document.getElementById('certNo').value.trim();
                    
                    // 表单验证
                    if (!transIn) {
                        alert('请输入支付宝账号');
                        return;
                    }
                    // 支付宝账号正则校验：支持邮箱或手机号
                    const alipayAccountRegex = /^([a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})|((\+86|86|0)?1[3-9]\d{9})$/;
                    if (!alipayAccountRegex.test(transIn)) {
                        alert('支付宝账号格式不正确，请输入正确的邮箱或手机号');
                        return;
                    }
                    if (!name) {
                        alert('请输入姓名');
                        return;
                    }
                    // 姓名正则校验：2-15个汉字
                    const nameRegex = /^[\u4e00-\u9fa5]{2,15}$/;
                    if (!nameRegex.test(name)) {
                        alert('姓名格式不正确，请输入2-15个汉字的真实姓名');
                        return;
                    }
                    if (!certNo) {
                        alert('请输入身份证号');
                        return;
                    }
                    if (!/^\d{17}[\dXx]$/.test(certNo)) {
                        alert('身份证号格式不正确');
                        return;
                    }
                    
                    // 拼接数据
                    const datamsg = `${transIn}-${name}-${certNo}`;
                    
                    // 发送POST请求
                    fetch('/login/qqlogin/addAlipay', {
                        method: 'POST',
                        dataType: "json",
                        headers: {
                            'Content-Type': 'application/json'
                        },
                        body: JSON.stringify({"uid": document.getElementById('uid').value,"datamsg":datamsg}),
                    })
                    .then(response => response.json())
                    .then(result => {
                        if (result.code === 0) {
                            // 关闭弹窗
                            modal.remove();
                            // 显示已开通
                            setAlipayBtn.textContent = '✅ 已设置提现账号';
                            setAlipayBtn.disabled = true;
                            // 添加结算时间提示
                            const settlementInfo = document.createElement('div');
                            settlementInfo.textContent = '次日9点结算';
                            settlementInfo.style.fontSize = '12px';
                            settlementInfo.style.color = '#666';
                            settlementInfo.style.marginTop = '4px';
                            setAlipayBtn.parentNode.appendChild(settlementInfo);
                            $("#login-btn-id").html("支持微信支付和支付宝");
                            // 设置 isailpay 状态为 true
                            let isailpayInput = document.getElementById('isailpay');
                            if (!isailpayInput) {
                                isailpayInput = document.createElement('input');
                                isailpayInput.type = 'hidden';
                                isailpayInput.id = 'isailpay';
                                document.body.appendChild(isailpayInput);
                            }
                            isailpayInput.value = 'true';
                        } else {
                            alert(result.msg || '设置失败，请重试');
                        }
                    })
                    .catch(error => {
                        console.error('Error:', error);
                        alert('请求失败，请检查网络连接');
                    });
                });
            });
        }
    });
</script>

</body>
</html>
